<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi" />
    <title>积分商城</title>
    <meta name="keywords" content="">
    <script type="text/javascript">
        window.Env = {
            "sales_title_tag": "flight_hotel",
            "WWW_HOST": "www.mafengwo.cn",
            "IMG_HOST": "images.mafengwo.net",
            "W_HTTP": "http:\/\/w.mafengwo.cn",
            "P_HOST": "passport.mafengwo.cn",
            "P_HTTP": "https:\/\/passport.mafengwo.cn",
            "PAGELET_HTTP": "http:\/\/pagelet.mafengwo.cn",
            "JS_HOST": "js.mafengwo.net",
            "TONGJI_HOST": "tongji.mafengwo.cn",
            "UID": 0,
            "CSTK": "1e96d153fa48f68a3e0fbeb6d2b5a181_138294fe6e43e69f37365932c55dfc07",
            "GOOGLE_MAP_KEY": "AIzaSyD-Su0x_rPy1xehlMBcMyTqWkU49Bk53nQ"
        };
    </script>

    <link href="http://css.mafengwo.net/css/cv/css+base:css+jquery.suggest:css+plugins:css+plugins+jquery.jgrowl:css+other+popup:css+mfw-header.2015^YlVS^1527308432.css"
          rel="stylesheet" type="text/css"/>
    <script type="text/javascript">
        var __mfw_uid = parseInt('0');
    </script>
    <link href="http://css.mafengwo.net/css/cv/css+sales+m-toolbar:css+sales+sales-index-v5:css+sales+brand-bar:css+mfweditor+mfweditor^a10^1524639062.css"
          rel="stylesheet" type="text/css"/>
    <script src="/js/common.js"></script>
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/messager/jquery.bootstrap.min.js"></script>

    <script>
        $(function () {
            var userId = getParams().userId;
            //我的积分回显
            $.get('/users/' + userId + '/credits', function (data) {
                if (data) {
                    var myCredit = data.credit + '积分';
                    $('#myCredit').html(myCredit);
                }
            })
            //推荐回显
            var currentPage = 1;
            var totalPage = 2;
            var query = function () {
                if (currentPage > totalPage) {
                    currentPage = 1;
                }
                $.get('/products', {isRecommend: 1, currentPage: currentPage, pageSize: 4}, function (data) {
                    totalPage = data.pages;
                    $('#hotProduct').renderValues(data, {
                        setHref:function (item,value) {
                            $(item).attr('href', '/productExpend.html?productId=' + value + '&userId=' + userId);
                        }
                    });
                    currentPage += 1;
                });
            }
            query();
            //推荐翻页
            $('.change').click(function () {
                query();
            })
            //商品回显
            $.get('/products/types', function (data) {
                $('#normalProduct').html(data);
                $('.setUserId').click(function () {
                    var href = $(this).data('href');
                    $(this).attr('href', href + '&userId=' + userId);
                })
                $('.more').click(function () {
                    var href = $(this).data('href');
                    $(this).attr('href', href + '&userId=' + userId);

                })
            })
            //搜索框
            $('#btn_keyword').click(function () {
                var keyword = $('#ipt_keyword').val();
                if (keyword) {
                    window.location.href = '/productDetail.html?keyword=' + keyword;
                }
            })
            //跳转购物车
            $('#toShoppingCart').click(function () {
                $(this).attr('href', '/shoppingCart.html?userId=' + userId);
            })
            //跳转轮盘
            $('#toLuckRun').click(function () {
                $(this).attr('href', '/luckRun.html?userId=' + userId);
            })

        })
    </script>
</head>
<body style="min-width: 100px">

<div class="container">
    <!--sousuo start-->
    <div class="brand-bar clearfix">
        <div class="bb-hd">
            <div class="bb-title">
                <a href="http://www.mafengwo.cn/sales/" style="text-decoration: none;"><i class="icon-fh"></i>积分商城</a>
            </div>
        </div>
        <div class="bb-hd">
            <div class="search-panel">
                <div class="search-main" data-search="1">
                    <div class="clearfix">
                        <input data-new-search-depart=1 id="ipt_keyword" class="search-input" type="text"
                               placeholder="请输入商品名称">
                        <a id="btn_keyword" data-mes-t="按钮" class="search-button" href="javascript:;"><i></i></a>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div data-mes-g="1" data-mes-t="SH" id="layout_area">
        <div class="mod-promo" data-change="mod"
             data-mes-g="1" data-mes-t="模块本周热销榜">
            <div class="mod-hd" data-mes-g="1-0" data-mes-t="顶部区">
                <a href="/sales/list_more.php?label=%E6%9C%AC%E5%91%A8%E7%83%AD%E9%94%80%E6%A6%9C" target="_blank"
                   data-mes-g="1-0-0" data-mes-t="标题">
                    <h2>推荐热销榜</h2>
                </a>
                <h2><span>大家都在买</span></h2>
                <a data-change="btn" class="change" href="javascript:void(0);"
                   data-mes-g="1-0-1" data-mes-t="换一换">
                    <i></i>换一换
                </a>
            </div>
            <div class="mod-bd" data-mes-g="1-1" data-mes-t="产品区" id="hotProduct">
                <ul class="sales-cards clearfix" data-change-step="not-set" id="Js_hotSalesImg">
                    <div render-loop="list">
                    <li class="item" data-change="list">
                        <a data-href="/productExpend.html" target="_blank" render-fun="setHref" render-key="list.id"
                           data-mes-g="1-1-0" data-mes-t="位置0"
                           data-mes-salesid="2712420">
                            <div class="image">
                                <img render-src="list.coverUrl" height="134" width="238">
                            </div>
                            <div class="caption">
                                <h3 render-html="list.name"></h3>
                                <span class="price"><b render-html="list.price"></b>积分</span>

                                <span style="float: right;padding-top: 8px;font-size: 12px;color: #666;" class="careBtn">查看详情</span>
                            </div>
                        </a>
                    </li>
                    </div>
                </ul>
            </div>
        </div>
        <div id="normalProduct">

        </div>


    </div>
</div>
<div class="sales-toolbar">
    <div class="stbar-middle">
        <div class="stbar-nav">
            <div class="stbar-item stbar-order">
                <a href="javascript:;" target="_blank" id="toShoppingCart">
                    <i class="stbar-icon"></i><span class="stbar-text">购物车</span>
                </a>
            </div>
            <div class="stbar-item stbar-coupon">
                <a href="javascript:;" target="_blank">
                    <i class="stbar-icon"></i><span class="stbar-text" id="myCredit"></span>
                </a>
            </div>
            <div class="stbar-item stbar-collect">
                <a href="javascript:;" target="_blank" id="toLuckRun">
                    <i class="stbar-icon"></i><span class="stbar-text">幸运轮盘</span>
                </a>
            </div>
        </div>
    </div>
</div>

</body>
</html>
